package com.example.demo.service.business;

import com.example.demo.dao.business.OrderDAO;
import com.example.demo.dao.warehouse.WarehouseDAO;
import com.example.demo.model.business.Order;
import com.example.demo.model.warehouse.Warehouse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderService {
    @Autowired
    private OrderDAO dao;


    //    查询全部
    public List<Order> selectAll() {
        return dao.selectAll();
    }

    //    添加数据
    public Integer addOrder(Order order) {
        return dao.addOrder(order);
    }

    //删除数据
    public Integer deleteById(Integer order_id) {
        return dao.deleteById(order_id);
    }

    //更新
    public Integer updateById(Order order) {
        return dao.updateById(order);
    }

    //根据id更新状态
    public Integer updateStatusById(Integer order_id) {
        return dao.updateStatusById(order_id);
    }

    public List<Order> findOrder(Integer order_number, String customer_name) {
        return dao.findOrder(order_number, customer_name);
    }

    public Boolean save(Order order) {

        Boolean flag = false;

        flag = dao.addOrder(order) == 1;

        return flag;
    }
}
